/**
 * @USER: Administrator
 * @DATE: 2024/9/22 上午9:28
 * @VERSION: 1.0.0
 */
public class LC3079 {
    public int sumOfEncryptedInt(int[] nums) {
        int sum = 0;
        for (int i = 0; i < nums.length; i++) {
            sum += encrypt(nums[i]);
        }
        return sum;
    }

    public static void main(String[] args) {
        LC3079 lc3079 = new LC3079();
        System.out.println(lc3079.encrypt(10));
    }

    public int encrypt(int num){

        String s = num + "";
        int length = s.length();
        int max=0;
        StringBuilder result = new StringBuilder();
        for (int i = 0; i < length; i++) {
            if (s.charAt(i)-'0' > max) {
                max = s.charAt(i)-'0';
            }
        }
        result.append(String.valueOf(max).repeat(length));

        return Integer.parseInt(result.toString());
    }

}
